﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DbSharp.GuiRunner.Properties;
using System.IO;

namespace DbSharp.GuiRunner.UI
{
    partial class FormOptions : Form
    {
        public FormOptions()
        {
            InitializeComponent();
        }

        void LoadOptions()
        {
            textBoxDiffTool.Text = Settings.Default.DiffToolPath.Trim();
        }


        void SaveOptions()
        {
            Settings.Default.DiffToolPath = textBoxDiffTool.Text;

            Settings.Default.Save();
        }



        private void buttonBrowseDiff_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Application files|*.exe|All files|*.*";
            openFileDialog1.Title = "Choose a diff tool";
            try
            {
                openFileDialog1.InitialDirectory = Path.GetDirectoryName(textBoxDiffTool.Text);
            }
            catch { /*suppress all exception*/}
            if (DialogResult.OK == openFileDialog1.ShowDialog())
            {
                textBoxDiffTool.Text = openFileDialog1.FileName;
            }
        }

        private void btnTestConnection_Click(object sender, EventArgs e)
        {
            SaveOptions();
            this.DialogResult=DialogResult.OK ;
        }

        private void FormOptions_Load(object sender, EventArgs e)
        {
            LoadOptions();
        }

        private void textBoxDiffTool_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
